// 刷新时间
function addZeor(n) {
  return n < 10 ? '0' + n : n;
}

// 格式化当前时间
function getNowTime() {
  let date = new Date();
  return `${addZeor(date.getHours())}:${addZeor(date.getMinutes())}:${addZeor(date.getSeconds())}`;
}

// 格式化日期
function formatDate(t, e) {
  var i = function (t) {
    return t > 9 ? t : "0" + t;
  };
  return (
      ("number" == typeof t || "string" == typeof t) && (t = new Date(t)),
          [t.getFullYear(), i(t.getMonth() + 1), i(t.getDate())].join(e || "")
  );
}

// 加载天气
function getTianqi() {
  $.getJSON("https://tianqiapi.com/api?version=v6&appid=12319429&appsecret=9MgizMGR", (data) => {

    $("#weatherImg").attr("src", `images/weather/${data["wea"]}.png`)
    $("#weather").html(`<p class="active">${data["wea"]}</p>
                <p >${data["tem1"]}-${data["tem2"]}℃</p>           
                 <p>${data["country"]}-${data["city"]}</p>`)
  })
}



